home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr49
/
118_01.zip
/
DATE.BDS
< prev
next >
Wrap
Text File
|
1993-06-03
|
2KB
|
93 lines
/* Time and date routines for Software Tools
* source: date.bds
* version: August 22, 1981
*/
#include tools.h
/* fmtdat - format date and time information into date
* form is reserved for a format selector.
* time is a scratch buffer
*/
fmtdat (date, time, now, form)
char *date, *time, *now;
int form;
{
/* copy now to date. do not copy newline */
while (*now != NEWLINE && *now != EOS) {
*date++ = *now++;
}
*date = EOS;
/* comment out ----- format date and time
date [0] = now [1] / 10 + '0';
date [1] = now [1] % 10 + '0';
date [2] = '/';
date [3] = now [2] / 10 + '0';
date [4] = now [2] % 10 + '0';
date [5] = '/';
date [6] = now [0] % 100 / 10 + '0';
date [7] = now [0] % 10 + '0';
date [8] = EOS;
time [0] = now [3] / 10 + '0';
time [1] = now [3] % 10 + '0';
time [2] = '/';
time [3] = now [4] / 10 + '0';
time [4] = now [4] % 10 + '0';
time [5] = ':';
time [6] = now [5] / 10 + '0';
time [7] = now [5] % 10 + '0';
time [8] = EOS;
----- end comment out */
}
/* getnow - return pointer to current time and date */
char * getnow ()
{
if (sys_date [0] == EOS) {
putlin("\nEnter date: \n", SYS_TERM);
getlin(sys_date, SYS_TERM);
if (sys_date [0] == EOS) {
sys_date [0] == ' ';
sys_date [1] == EOS;
}
}
return(sys_date);
/* comment out ----- set now [], date []
now [0] = 1981; /* the year */
now [1] = 1; /* the month */
now [2] = 1; /* the day */
now [3] = 23; /* the hour (24-hour clock) */
now [4] = 59; /* the minute of the hour */
now [5] = 59; /* the second of the minute */
now [6] = 999; /* the millisecond */
----- end comment out */
}
/* wkday - get day-of-week corresponding to month,day,year */
int wkday (month, day, year)
int month, day, year;
{
month = month - 2;
if (month <= 0) {
month = month + 12;
year--;
}
return (
((day + (26 * month - 2) /10 +year +year/4 -34) % 7)+ 1
);
}